package com.overlord.im.commons.constant;

import java.util.stream.Stream;

/**
 * All rights Reserved, Designed By www.szy.cn
 *
 * @author wuwei
 * @title SystemType
 * @package com.overlord.im.commons.constant
 * @date 2021-03-17 15:50
 * @Copyright 2014-现在 All rights reserved. 厦门神州鹰软件科技有限公司
 */
public enum SystemType {

    /**
     * 非心跳
     */
    NONE(-1),
    /**
     * 心跳消息
     */
    HEART_BEAT(1),
    ;

    int code;

    SystemType(int code) {
        this.code = code;
    }

    public static SystemType fromCode(int code) {
        return Stream.of(values()).filter(t -> t.code == code).findFirst().orElseThrow(IllegalArgumentException::new);
    }

    public int getCode() {
        return code;
    }
}
